<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Hello AMD!</title>
</head>
<body>
<div id="log"></div>

<!-- load Dojo -->
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js"
        data-dojo-config="
          async: true,
          packages: [
            {name: 'sockjs', location: '/sockjs-client/dist', main: 'sockjs'},
            {name: 'vertx-eventbus', location: '/vertx3-eventbus-client', main: 'vertx-eventbus'}
          ]"></script>

<script>
  require([
    'dojo/dom',
    'dojo/dom-construct',
    'vertx-eventbus'
  ], function (dom, domConstruct, EventBus) {
    var loggingNode = dom.byId('log');

    var eb = new EventBus('/eventbus/');

    eb.onopen = function () {
      eb.registerHandler('feed', function (err, msg) {
        domConstruct.place('<div>' + msg.body.now + '</div>', loggingNode);
      });
    };
  });
</script>
</body>
</html>
